<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class cutsize extends CI_Controller 
	{
			public function worklist()
			{
			echo  $this->cutsize_model->getWorklist();
			}
			public function getDataCutSize()
			{
			 	$inputData = array(
					"form_id"=>"2",
					"type_of"=>$this->input->post("cutsizeCS1"),
					"gram"=>$this->input->post("cutsizeCS2"),
					"brand"=>$this->input->post("cutsizeCS3"),
					"grade"=>$this->input->post("cutsizeCS4"),
					"size"=>$this->input->post("cutsizeCS5"),
					"lot_no"=>$this->input->post("cutsizeCS6"),
					"position"=>$this->input->post("cutsizeCS7"),
					"shift"=>$this->input->post("cutsizeCS8"),
					//"start_date"=>$this->input->post("cutsizeCS9"),
					//"end_date"=>$this->input->post("cutsizeCS10"),
					//"modify_user"=>$this->session->userdata('user_id'),
				);
			 	$text = "";
			 	$inputAllData=array();
			 	for($i=17;$i<=83;$i++){
				$data= array();
				$data = array(
			 	"data_name"=> "cutsizeCS".$i,
			 	"data_value"=> $this->input->post("cutsizeCS".$i."_1"),
			 	);
			 	$inputAllData[]=$data;
			 	}
				//print_r($inputAllData);
				print_r( $this->cutsize_model->keyInCutSize($inputData,$inputAllData));

			}
			public function newDataCutSize()
			{
			 	$inputData = array(
					"form_id"=>"2",
					//"modify_date"=>$this->input->post("finalcheckFC1"),
					"type_of"=>$this->input->post("cutsizeCS1"),
					"gram"=>$this->input->post("cutsizeCS2"),
					"brand"=>$this->input->post("cutsizeCS3"),
					"grade"=>$this->input->post("cutsizeCS4"),
					"size"=>$this->input->post("cutsizeCS5"),
					"lot_no"=>$this->input->post("cutsizeCS6"),
					"position"=>$this->input->post("cutsizeCS7"),
					"shift"=>$this->input->post("cutsizeCS8"),
					"start_date"=>$this->input->post("cutsizeCS9"),
					"end_date"=>$this->input->post("cutsizeCS10"),
					"modify_user"=>$this->session->userdata('user_id'),
					"status"=> '1'
				);
			 	$text = "";
			 	$inputAllData=array();
			 	for($i=17;$i<=83;$i++){
				$data= array();
				$data = array(
			 	"data_name"=> "cutsizeCS".$i,
			 	"value_start"=> $this->input->post("cutsizeCS".$i."_1"),
			 	"value_end"=> $this->input->post("cutsizeCS".$i."_2")
			 	);
			 	$inputAllData[]=$data;
			 	}
				//print_r($inputAllData);
				echo $this->cutsize_model->checkCutSize($inputData,$inputAllData);

			}
		public function detail_cutsize()
		{
			$t_id = $this->uri->segment(3);
			$data['rs1']=$this->cutsize_model->detail_cutsize1($t_id);
			$data['rs2']=$this->cutsize_model->detail_cutsize2($t_id);
			//print_r ($data['rs']);
			$this->load->view('template/template');
			$this->load->view("detail/CutSize",$data);
			$this->load->view('template/footer');
		}
		public function information_cutsize()
		{
			$mt_id = $this->uri->segment(3);
			$data['rs1']=$this->cutsize_model->information_cutsize1($mt_id);
			$data['rs2']=$this->cutsize_model->information_cutsize2($mt_id);
			//print_r ($data['rs1']);
			$this->load->view('template/template');
			$this->load->view("information/CutSize",$data);
			$this->load->view('template/footer');
		}
	}
